﻿using NLog;
using System;

namespace MyFrame
{
    public class LogHelper:ILog
    {
        static Logger error = LogManager.GetLogger("Error");
        static Logger info = LogManager.GetLogger("Info");
        //public static void Info(string log)
        //{
        //    info.Info(DateTimeNowStr(log));
        //}
        //public static void Error(string log)
        //{
        //    error.Error(DateTimeNowStr(log));
        //}
        private static string DateTimeNowStr(string log)
        {
            if (string.IsNullOrEmpty(log))
            {
                return "";
            }
            return $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")} {log}";
        }

        public void Info(string message)
        {
            info.Info(DateTimeNowStr(message));
        }

        public void ErrorInfo(string message)
        {
            error.Error(DateTimeNowStr(message));
        }
    }
}
